package myapp.com.myapplication.P;

import com.xm.httpapi.BaseView.BasePresenter;
import myapp.com.myapplication.IRequest;
import myapp.com.myapplication.Model.LoginResult;
import myapp.com.myapplication.Model.PwdLoginRequest;
import myapp.com.myapplication.Model.RequestModel;
import myapp.com.myapplication.RequestMvpActivity;


public class RequestPresenter extends BasePresenter<RequestMvpActivity, RequestModel> implements IRequest.IPresenter {


    @Override
    public void load(PwdLoginRequest pwdLoginRequest, boolean handleErr) {
        if (handleErr)
            model.getData(pwdLoginRequest, request(data -> getView().setData((LoginResult) data), err -> getView().err(err)));
        else
            model.getData(pwdLoginRequest, request(data -> getView().setData((LoginResult) data)));
    }

}
